package com.zengqingfa.canal.handler;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import top.javatool.canal.client.annotation.CanalTable;
import top.javatool.canal.client.handler.EntryHandler;

import java.io.Serializable;

/**
 * @fileName: UserHandler
 * @author: zengqf3
 * @date: 2021-1-8 15:33
 * @description:
 */
@Slf4j
@Component
@CanalTable(value = "lesson")
public class UserHandler implements EntryHandler<UserHandler.Lesson> {

    @Override
    public void insert(Lesson lesson) {
        log.info("insert message  {}", lesson);
    }

    @Override
    public void update(Lesson before, Lesson after) {
        log.info("update before {} ", before);
        log.info("update after {}", after);
    }

    @Override
    public void delete(Lesson lesson) {
        log.info("delete  {}", lesson);
    }

    @Data
    public static class Lesson implements Serializable {

        private Integer id;
        private String name;
        private Integer credit;
        private String teacher;

    }

}

